public class E01_Runnable {

	public static void main(String[] args) {
		for (int i = 0; i < 5; i++) {
			Thread t = new Thread(new Printer());
			t.start();
		}
	}
}

class Printer implements Runnable {
	private int countDown = 3;
	private static int taskCount = 0;
	private final int id = taskCount++;

	public Printer() {
		System.out.println("Printer:" + id + " runnable");
	}

	@Override
	public void run() {
		while (countDown-- > 0) {
			System.out.print("  #(" + id + ")" + (countDown > 0 ? " " + countDown : " off"));
			Thread.yield();
		}
	}

}
